/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SMART_SERVE_PLUGIN_DUMMY_MODEL_H
#define SMART_SERVE_PLUGIN_DUMMY_MODEL_H

#include <model/adapter.h>
#include <model/creator.h>

#include <smart_serve_log.h>

namespace OHOS {
namespace SmartServe {

#define TAG "[DummyModelAdapter] "

class DummyModelAdapter : public ModelAdapter {
public:
    DummyModelAdapter(const std::string& name) : name_(name)
    {}

    const std::string& Name() const override
    {
        return name_;
    }

    const std::vector<ModelResConfig>& InitialResConfigs() const override
    {
        static std::vector<ModelResConfig> cfgs{
            ModelResConfig{.memSize_ = 10},
            ModelResConfig{.memSize_ = 5},
        };
        return cfgs;
    }

    ModelApplyResult ApplyResConfig(const ModelResConfig& target) override
    {
        (void)target;
        SMART_SERVE_LOGD(TAG "%s: ApplyResConfig", name_.c_str());
        return ModelApplyResult::SUCCESSFUL;
    }

    void Finalize() override
    {
        SMART_SERVE_LOGD(TAG "%s: Finalize", name_.c_str());
    }

private:
    std::string name_;
};

class DummyModelCreator : public ModelCreator {
public:
    DummyModelCreator(const std::string& name) : name_(name)
    {}

    const std::string& Name() const override
    {
        return name_;
    }

    std::unique_ptr<ModelAdapter> Create() override
    {
        return std::make_unique<DummyModelAdapter>(name_);
    }

private:
    std::string name_;
};

#undef TAG

} // namespace SmartServe
} // namespace OHOS

#endif // SMART_SERVE_PLUGIN_DUMMY_MODEL_H
